package demo.user.controller;


import demo.user.dto.StatusDTO;
import demo.user.service.StatusService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author LonelySnow
 * @since 2020-06-15
 */
@RestController
public class StatusController {

    @Autowired
    private StatusService statusService;

    @GetMapping("/getStatus")
    @ApiOperation(value = "获取用户权限接口")
    @ApiResponse(code = 200, message = "获取用户权限成功")
    public ResponseEntity<StatusDTO> getUserStatus(
            @ApiParam(value = "用户id", example = "1") @RequestParam("id") Long uid) {
        StatusDTO userStatus = statusService.getUserStatus(uid);
        return ResponseEntity.ok(userStatus);
    }

}

